home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / c / gedindent.lha / blockindent.ged next >
Text File  |  1994-07-16  |  820b  |  32 lines

  1. /* $VER: 1.0, ©1994 Michael Bauer - Indent a block */
  2.  
  3. OPTIONS RESULTS                             /* enable return codes     */
  4.  
  5. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  6.     address 'GOLDED.1'
  7.  
  8. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  9. OPTIONS FAILAT 6                            /* ignore warnings         */
  10. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  11.  
  12. /* Name the marked block and save it */
  13. 'SAVE BLOCK NAME="dtmp:golded.indent"'
  14.  
  15. /* Indent the saved code */
  16. SHELL
  17. 'indent -br -i4 -sob -sc -npsl -o dtmp:golded.new dtmp:golded.indent'
  18. SHELL
  19.  
  20. 'DELETE BLOCK'
  21.  
  22. 'OPEN NAME="dtmp:golded.new" INSERT'
  23.  
  24. 'UNLOCK' /* VERY important: unlock GUI */
  25. EXIT
  26.  
  27. SYNTAX:
  28.  
  29. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  30. 'UNLOCK'
  31. EXIT
  32.